package com.sensePlusVR.utils;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.os.Build;
import android.view.View;

/**
 * 
 * @author: Loren
 * @create: 2016-7-4上午10:58:17
 * @desc: 隐藏手机底部Navigation
 *
 */
@SuppressLint("InlinedApi")
public class HiddenNavigation implements Runnable{

	
	private Activity context;
	
	public HiddenNavigation(Activity context){
		this.context = context;
	}
	@Override
	public void run() {
		  
        int flags;    
        int curApiVersion = Build.VERSION.SDK_INT;
        // This work only for android 4.4+  
        if(curApiVersion >= Build.VERSION_CODES.KITKAT){  
            // This work only for android 4.4+  
            // hide navigation bar permanently in android activity  
            // touch the screen, the navigation bar will not show  
            flags = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION  
                  | View.SYSTEM_UI_FLAG_IMMERSIVE  
                  | View.SYSTEM_UI_FLAG_FULLSCREEN
                  | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;  
                  
        }else{  
            // touch the screen, the navigation bar will show  
            flags = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;  
        }  
          
        // must be executed in main thread :)  
        context.getWindow().getDecorView().setSystemUiVisibility(flags);  
    
	}

}
